<?php
/**
 * Date: 2017/12/21
 * Time: 13:24
 * Author: zeronlee
 */

namespace App\Services\Handle;


class Handle
{
    /**
     * 获取当前控制器与方法
     *
     * @return array
     */
    public function getCurrentAction () {
        $action = \Route::current()->getActionName();
        list($class, $method) = explode('@', $action);
        $class = substr(strrchr($class, '\\'), 1);

        return ['controller' => $class, 'method' => $method];
    }


    /**
     * 获取当前控制器名
     *
     * @return string
     */

    public function getCurrentControllerName () {
        return $this->getCurrentAction()['controller'];
    }


    /**
     * 获取当前方法名
     *
     * @return string
     */

    public function getCurrentMethodName () {
        return $this->getCurrentAction()['method'];
    }

}